﻿// -----------------------------------------------------------------------
//  <copyright file="GetOnlineUserQuery.cs" company="LiuliuSoft">
//      Copyright (c) 2025 66SOFT. All rights reserved.
//  </copyright>
//  <site>https://ifs.66soft.net</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2025-10-24 15:10</last-date>
// -----------------------------------------------------------------------

using DaprPlus.Identity.Domain.Entities;


namespace DaprPlus.Identity.Application.Identity.Users.Queries;

[AuthConfig(typeof(User), ResourceAccessType.LoggedIn, "GetOnline")]
public class GetOnlineUserQuery : SingleQuery<OnlineUser?>
{ }

public class GetOnlineUserQueryHandler(IServiceProvider provider)
    : IRequestHandler<GetOnlineUserQuery, OnlineUser?>
{
    public async Task<OnlineUser?> Handle(GetOnlineUserQuery request, CancellationToken cancellationToken)
    {
        return await provider.GetOnlineUser();
    }
}